<?php
class Db
{
	private $db;
	//单例模式
	public function __construct($dbtype,$param)
	{
		$dbtype="db$dbtype";
		if(!class_exists($dbtype))
		{
			Loader::load("db/$dbtype.php");
		}
		$this->db=new $dbtype($param);
	}
	public function __destruct()
	{
		
	}
	//参数SQL不能包含select如： * from member;
	public function select($sql,$sqlcount=false)
	{
	    return $this->db->select($sql,$sqlcount);
	}
	
	public function getLastQueryTotal()
	{
		return $this->db->getLastQueryTotal();
	}
	
	public function insert($data,$table)
	{
		return $this->db->insert($data,$table);
	}
	
	public function delete($sql)
	{
		return $this->db->delete($sql);
	}
	
	public function update($data,$where,$table)
	{
		return $this->db->update($data,$where,$table);
	}
	
	public function startTransaction()
	{
		$this->db->startTransaction();
	}
	
	public function getError()
	{
		return $this->db->getError();
	}
	
	public function rollBack()
	{
		$this->db->rollBack();
	}
	
	public function commit()
	{
		$this->db->commit();
	}
	public  function execute($sql)
	{
		return $this->db->execute($sql);
	}
}